<?php


	namespace lib\exception;


	class ErrorHandler extends \yii\web\ErrorHandler
	{
		public function renderException ($exception) {
			if ($exception instanceof ApiException) {
				exit(json_encode(toast($exception->message, $exception->code, [
					'file' => $exception->getFile(),
					'line' => $exception->getLine()
				])));
			} else {

			}

			if (!YII_DEBUG) {//关闭调试模式
				exit(json_encode(toast($exception->getMessage(), $exception->getCode(), [
					'file' => $exception->getFile(),
					'line' => $exception->getLine()
				])));
			}

			parent::renderException($exception);
		}

	}
